package com.beyond.SearchNearby;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.widget.ListView;
import android.widget.SimpleAdapter;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class IndexActivity extends Activity {
    private ListView indexListView;
    private List<Map<String,Object>> dateList = new ArrayList<Map<String, Object>>();
    private SimpleAdapter listViewAdapter ;

    /**
     * Called when the activity is first created.
     */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.index);
        indexListView = (ListView) findViewById(R.id.index_listView);
        listViewAdapter  = new SimpleAdapter(this,dateList,R.layout.index_content_item,new String[]{"text"},new int[]{R.id.index_content_list_textView});
        indexListView.setAdapter(listViewAdapter);
    }

    @Override
    protected void onResume() {
        initDate();
        super.onResume();
    }

    private void initDate() {
        dateList.clear();
        String[] strings = new String[]{"餐饮服务","购物服务","生活服务","体育休闲服务","医疗保健服务","住宿服务","科教文化服务","交通设施服务","公共设施服务","公共设施服务","公共设施服务"};
        for (int i = 0;i<strings.length;i++){
           Map<String,Object> map = new HashMap<String, Object>();
            map.put("text",strings[i]);
            dateList.add(map);
        }
        listViewAdapter.notifyDataSetChanged();
    }

    public void seekOnClick(View view){
        Intent intent = new Intent(this,SeekActivity.class);

        startActivity(intent);
    }

    public void settingOnClick(View view){
          Intent intent = new Intent(this,SettingActivity.class);
//        this.finish();
        startActivity(intent);
    }

    private void gotoNextView(Activity activity,String imagePath,int imageSource) {
        Intent intent = new Intent();
//        intent.setClass(this,activity.class);
        startActivity(intent);
    }
}
